# -*- coding: utf-8 -*-
# @File: config.py
# @Author: Liccsu
# @Time: 12/8/2022 下午7:56
# @Project: eschool-health

import configparser
import os

# try:
#     from stoppers import StopProcess
# except ModuleNotFoundError or ImportError:
#     from .stoppers import StopProcess

BASE_PATH = os.path.dirname(os.path.abspath(__file__))
config_path = os.path.join(BASE_PATH, '../config/config.cfg')


class Config:
    def __init__(self):
        self.config = configparser.ConfigParser()
        self.config.read(config_path, encoding='utf-8')

        # self.user_data = self.config.options('UserData')
        # self._user_name = self.config.get('UserData', 'userName')
        # self._school_code = self.config.get('UserData', 'schoolCode')
        # self._school_name = self.config.get('UserData', 'schoolName')
        self._user_id = self.config.get('UserData', 'userId')
        self._session_id = self.config.get('UserData', 'sessionId')
        # self.email_data = self.config.options('EMailData')
        self._send_mail = self.config.get('EMailData', 'send_mail')
        self._mail_key = self.config.get('EMailData', 'mail_key')
        self._mail_host = self.config.get('EMailData', 'mail_host')
        self._recv_mail = self.config.get('EMailData', 'recv_mail')
        # self.task_data = self.config.options('TaskData')
        self._cron_tab = self.config.get('TaskData', 'cron_tab')

    @property
    def user_id(self):
        return self._user_id

    # @property
    # def user_name(self):
    #     return self._user_name
    #
    # @property
    # def school_code(self):
    #     return self._school_code
    #
    # @property
    # def school_name(self):
    #     return self._school_name

    @property
    def session_id(self):
        return self._session_id

    @property
    def send_mail(self):
        return self._send_mail

    @property
    def mail_key(self):
        return self._mail_key

    @property
    def mail_host(self):
        return self._mail_host

    @property
    def recv_mail(self):
        return self._recv_mail

    @property
    def cron_tab(self):
        return self._cron_tab


Cfg = Config()

if __name__ == '__main__':
    print(Cfg)
